package com.typhoon.rpc.common.dto;

import java.io.Serializable;

public class RpcResponse implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3053815333408674281L;

	 /**
     * 请求id
     */
    private String requestId;
    
    /**
     * 调用异常
     */
    private Exception exception;
    
    /**
     * 调用结果
     */
    private Object result;
    
    public static RpcResponse create(String requestId, Exception exception, Object result) {
    	return new RpcResponse(requestId, exception, result);
    }

	public RpcResponse() {
		super();
	}
	
	

	private RpcResponse(String requestId, Exception exception, Object result) {
		super();
		this.requestId = requestId;
		this.exception = exception;
		this.result = result;
	}

	 public boolean hasException() {
	        return exception != null;
	    }


	public String getRequestId() {
		return requestId;
	}

	public void setRequestId(String requestId) {
		this.requestId = requestId;
	}

	public Exception getException() {
		return exception;
	}

	public void setException(Exception exception) {
		this.exception = exception;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}
    
}
